<?php
// +----------------------------------------------------------------------
// | Yzncms [ 御宅男工作室 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://yzncms.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | fastadmin: https://www.fastadmin.net/
// +----------------------------------------------------------------------

// +----------------------------------------------------------------------
// | 前台配置提交接口
// +----------------------------------------------------------------------
namespace app\api\controller;

use app\common\controller\Api;
use app\common\library\Sms as Smslib;
use app\common\model\KuaiShouConfigModel;
use app\common\model\KuaiShouModel;
use think\facade\Hook;
use think\facade\Validate;
use think\Request;


class KuaiShouConfig extends Api
{
    /**
     * @param Request $request
     * @return void
     */
    public function index(Request $request)
    {
        //获取配置
        $config = KuaiShouConfigModel::column(KuaiShouConfigModel::VALUE, KuaiShouConfigModel::NAME);
        if (!empty($config)) {
            $config['index_banner'] = '//' . $_SERVER['HTTP_HOST'] . $config['index_banner'];
            $config['code_banner'] = '//' . $_SERVER['HTTP_HOST'] . $config['code_banner'];
        }
        $this->success('ok', ['config' => $config]);
    }
}
